chrome.runtime.onInstalled.addListener(() => {
    chrome.storage.local.set({ status: 'idle' });
  });
  
  chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
    if (message === '开始检查') {
      chrome.storage.local.set({ status: 'running' });
  
      chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
        const tab = tabs[0];
        chrome.scripting.executeScript({
          target: { tabId: tab.id },
          function: () => {
            // 检查页面逻辑
            chrome.runtime.sendMessage({ message: '检查完成' });
          }
        });
      });
    }
  });
  
  chrome.runtime.onMessage.addListener((message) => {
    if (message === '检查完成') {
      chrome.storage.local.set({ status: 'idle' });
    }
  });
  